package cn.edu.jmu.oelp.pojo;

import java.util.Objects;

public class ValidEntity {
    private int paragraphsId;
    private int articleId;
    private String content;
    private String type;
    private int count;

    public ValidEntity(int paragraphsId, int articleId, String content, String type, int count) {
        this.paragraphsId = paragraphsId;
        this.articleId = articleId;
        this.content = content;
        this.type = type;
        this.count = count;
    }

    public int getParagraphsId() {
        return paragraphsId;
    }

    public void setParagraphsId(int paragraphsId) {
        this.paragraphsId = paragraphsId;
    }

    public int getArticleId() {
        return articleId;
    }

    public void setArticleId(int articleId) {
        this.articleId = articleId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        ValidEntity that = (ValidEntity) o;
         if(paragraphsId == that.paragraphsId &&
                articleId == that.articleId&&
                 content.equals(that.content)){
             if (count<that.count) {
                 count=that.count;
                 type=that.type;
             }
             return true;
         }
         else return false;

    }

    @Override
    public int hashCode() {
        return Objects.hash(paragraphsId, articleId, content);
    }

    @Override
    public String toString() {
        return "ValidEntity{" +
                "paragraphsId=" + paragraphsId +
                ", articleId=" + articleId +
                ", content='" + content + '\'' +
                ", type='" + type + '\'' +
                ", count=" + count +
                '}';
    }
}
